*** Listing 1 *** /* * hn.h - interface definition for the HNL * * Copyright(c) 1988 by Hobart Corporation. * Used with permission. */ /* * port-level declarations */ enum hn_bps {HN_1200_BPS, HN_2400_BPS, HN_4800_BPS, HN_9600_BPS}; typedef unsigned hn_bps; enum hn_parity {HN_P_NONE, HN_P_ODD, HN_P_EVEN}; typedef unsigned hn_parity; #include typedef struct hn_port hn_port; #define hn_perror(p) (p->errno) hn_port *hn_popen(char *dev, hn_bps bps, hn_parity par, unsigned data_bits, unsigned stop_bits); int hn_pclose(hn_port *p); int hn_pgetc(hn_port *p); int hn_pputc(int c, hn_port *p); int hn_pflush(hn_port *p); int hn_penable(hn_port *p); int hn_pdisable(hn_port *p); /* * stream-level declarations */ enum hn_model {HN_1860, HN_1865, HN_1870, ..., HN_SP1500}; typedef unsigned hn_model; struct hn_stream { unsigned si; /* scale id */ unsigned fc; /* function code */ hn_port *port; /* attached port */ char blk_buf[2048]; /* packet buffer */ int errno; /* error code */ . . }; typedef struct hn_stream hn_stream; #define hn_serror(s) (s->errno) hn_stream *hn_sopen (hn_port *p, unsigned si, hn_model m, unsigned fc); int hn_sclose(hn_stream *s); int hn_sgetc(hn_stream *s); int hn_sputc(int c, hn_stream *s);